<template>
	<view class="quantitativeRecords">
		<topTitle :title="$t('quantitativeRecords.quantitative_records')" />
		<view class="list" v-if="UsersQuantifyProjectSettlementOrderList.length">
			<view v-for="(item, idx) in UsersQuantifyProjectSettlementOrderList" :key="idx">
				<view>
					<view>
						<view>
							<view>{{ item.order_no }}</view>
							<view>{{ $t('quantitativeRecords.order_no') }}</view>
						</view>
						<view>
							<view>{{ item.issue }}</view>
							<view>{{ $t('quantitativeRecords.issue') }}</view>
						</view>
						<view>
							<view>{{ formattingTime(item.add_time) }}</view>
							<view>{{ $t('quantitativeRecords.order_time') }}</view>
						</view>
					</view>
					<view>
						<view>
							<view>{{ item.principal }}</view>
							<view>{{ $t('quantitativeRecords.principal') }}</view>
						</view>
						<view>
							<view class="profit">+{{ item.income }}</view>
							<view>{{ $t('quantitativeRecords.income') }}</view>
						</view>
						<view>
							<view>{{ item.rate }}</view>
							<view>{{ $t('quantitativeRecords.rate') }}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<noData v-else></noData>
	</view>
</template>

<script setup lang="ts">
import { ref, getCurrentInstance } from "vue";
import { onShow, onReachBottom } from "@dcloudio/uni-app";
const instance = getCurrentInstance()?.appContext.config.globalProperties;
import { UsersQuantifyProjectSettlementOrder } from "@/api/ProjectApi";

let UsersQuantifyProjectSettlementOrderList = ref<Array<any>>([]);
let select_time: any = null;
const UsersQuantifyProjectSettlementOrderFn = async () => {
	let list = await UsersQuantifyProjectSettlementOrder({
		select_time,
	});
	if (!select_time) {
		UsersQuantifyProjectSettlementOrderList.value = list;
	} else {
		UsersQuantifyProjectSettlementOrderList.value = [...UsersQuantifyProjectSettlementOrderList.value, ...list];
	}
};


onShow(() => {
	UsersQuantifyProjectSettlementOrderFn()
})
onReachBottom(() => {
	select_time = UsersQuantifyProjectSettlementOrderList.value[UsersQuantifyProjectSettlementOrderList.value.length - 1].add_time;
	UsersQuantifyProjectSettlementOrderFn();
});
</script>
<style scoped lang="scss">
@import "../../static/scss/quantification.scss";
</style>